<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        var arr = ['red', 'green', 'blue', 'skyblue', 'purple'];
        let arr1 = [];
        // 翻转数组
        function reverse(arr) {
            if (arr instanceof Array) {

            } else {
                console.log("当前参数不合法");
                return;
            }

            for (let i = arr.length - 1; i >= 0; i--) {
                // console.log(arr[i]);
                arr1[arr1.length] = arr[i];
            }
        }

        reverse("苹果");
        console.log(arr1);

        // 1. 判断当前对象是否为某个实例
        let d = new Date();
        console.log(arr instanceof Array);
        console.log(d instanceof Date);
        console.log(arr instanceof Date);

        // 2. 判断是否为数组
        console.log(Array.isArray(arr));
        console.log(Array.isArray(d));
    </script>
</head>

<body>

</body>

</html>